var index = new Vue({
    el: '#index',
    data: {
        adminName:"游戏管理后台",
        loginForm: {
            account: '',
            _token: _token,
            pass: ''
        },
        loginRules: {
            account: [
                {required: true, message: '请填写账号', trigger: 'blur'},
                {min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur'}
            ],
            pass: [
                {required: true, message: '请填写密码', trigger: 'blur'}
            ]
        }
    },
    methods: {
        submitForm: function (formName) {
            var _this = this;
            this.$refs[formName].validate(function (valid) {
                if (valid) {
                    $.post('/login/index' ,  _this.loginForm ,function(res){
                        if(res.code == 200){
                            window.location.href = res.data.url;
                        }else {
                            _this.$alert(res.message, "提示", {type: "warning"});
                        }
                    },'json');
                } else {
                    _this.$alert("信息填写格式有误", "提示", {type: "warning"});
                    return false;
                }
            });
        }
    }
});

